%%%-------------------------------------------------------------------
%% @doc mqeg_sup top level supervisor.
%% @end
%%%-------------------------------------------------------------------
-module(mqeg_sup).

-behaviour(supervisor).

-export([start_link/0]).

-export([init/1]).

-define(SERVER, ?MODULE).

start_link() ->
    supervisor:start_link({local, ?SERVER}, ?MODULE, []).

%% sup_flags() = #{strategy => strategy(),         % optional
%%                 intensity => non_neg_integer(), % optional
%%                 period => pos_integer()}        % optional
%% child_spec() = #{id => child_id(),       % mandatory
%%                  start => mfargs(),      % mandatory
%%                  restart => restart(),   % optional
%%                  shutdown => shutdown(), % optional
%%                  type => worker(),       % optional
%%                  modules => modules()}   % optional
init([]) ->
    SupFlags = #{ strategy  => one_for_all
                , intensity => 0
                , period    => 1
                },
    Publishers = #{ id       => mqeg_publishers_sup
                  , start    => {mqeg_publishers_sup, start_link, []}
                  , restart  => permanent
                  , shutdown => infinity
                  , type     => supervisor
                  , modules  => [mqeg_publishers_sup]
                  },
    Consumers = #{ id       => mqeg_consumers_sup
                 , start    => {mqeg_consumers_sup, start_link, []}
                 , restart  => permanent
                 , shutdown => infinity
                 , type     => supervisor
                 , modules  => [mqeg_consumers_sup]
                 },
    {ok, {SupFlags, [Publishers, Consumers]}}.


    
%% internal functions
